const { ccclass, property } = cc._decorator;

@ccclass
export default class MessageBox extends cc.Component {
  @property(cc.Label)
  text: cc.Label | null = null;
  @property(cc.Label)
  title: cc.Label | null = null;
  @property(cc.Label)
  btnText: cc.Label | null = null;

  public callbackOk: Function | null = null;
  public onClickOk() {
    if (this.callbackOk) {
      this.callbackOk();
    }
  }
  public show(title: string, text: string, btnText: string) {
    this.node.active = true;
    if (this.text) {
      this.text.string = text;
    }
    if (this.title) {
      this.title.string = title;
    }
    if (this.btnText) {
      this.btnText.string = btnText;
    }
  }
}
